<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page session="true"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/resources/css/jquery.mobile-1.4.2.css">
<script
	src="${pageContext.request.contextPath}/resources/js/jquery-1.11.0.min.js"></script>
<script
	src="${pageContext.request.contextPath}/resources/js/jquery.mobile-1.4.2.min.js"></script>
<script
	src="${pageContext.request.contextPath}/resources/js/jquery.validate.min.js"></script>
<script
	src="${pageContext.request.contextPath}/resources/js/google-map.js"></script>
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/resources/css/app.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/resources/css/dark-hive/jquery-ui-1.10.4.custom.min.css">

<script type="text/javascript">
	function initialize() {
		var w = $(window).width();
		var h = $(window).height();
		$("#divReportes").width(w);
		$("#divReportes").height(h);
	}
</script>

</head>


<body>
	<div data-role="page">


		<div data-role="header">
			<h1>Reporte</h1>
			<a
				href="${pageContext.request.contextPath}/control_panel?filter=${urlSafeFilter}"
				data-ajax="false" data-icon="arrow-l" data-iconpos="notext"></a> <a
				href="${pageContext.request.contextPath}/download?filter=${urlSafeFilter}"
				data-ajax="false" data-icon="arrow-d" data-iconpos="notext"></a>
		</div>
		<!-- /header -->

		<div role="main" class="ui-content">
			<div id="divReportes">



				<h2>Detalles del reporte</h2>
				<table class="outputTable fmt">
					<tr>
						<th>Disponibles</th>
						<td>${filter.avalible?'Si':'No'}</td>
						<th>No Disponibles</th>
						<td>${filter.notAvalible?'Si':'No'}</td>
						<th>Casas</th>
						<td>${filter.house?'Si':'No'}</td>
						<th>Departamentos</th>
						<td>${filter.app?'Si':'No'}</td>
						<th>Agricolas</th>
						<td>${filter.agr?'Si':'No'}</td>
						<th>Ultima visita desde</th>
						<td><fmt:formatDate value="${filter.from}"
								pattern="dd-MM-yyyy" /> <c:if test="${filter.from==null}">---</c:if>
						</td>
						<th>Ultima visita hasta</th>
						<td><fmt:formatDate value="${filter.to}" pattern="dd-MM-yyyy" />
							<c:if test="${filter.to==null}">---</c:if></td>
					</tr>
					<tr>
						<th>Percepcion baja</th>
						<td>${filter.low?'Si':'No'}</td>
						<th>Percepción media</th>
						<td>${filter.mid?'Si':'No'}</td>
						<th>Percepcion alta</th>
						<td colspan="1">${filter.hi?'Si':'No'}</td>
						<th>Amobladas</th>
						<td>${filter.furnitured?'Si':'No'}</td>
						<th>No Amobladas</th>
						<td>${filter.notFurnitured?'Si':'No'}</td>
						<th>Responsable</th>
						<td colspan="3">${agente.nombre}<c:if test="${agente==null}">---</c:if>
						</td>

					</tr>
				</table>
				<br />
				<h2>Propiedades</h2>

				<table class="outputTable fmt2">
					<tr>
						<th>Número</th>
						<th>Dirección</th>
						<th>Comuna</th>
						<th>Metros cuadrados</th>
						<th>Estado</th>
						<th>Fecha de Registro</th>
						<th>Visitas</th>
						<th>Ultima Visitas</th>
						<th>Percepción de venta/arriendo</th>
						<th>Responsable</th>
						<th>Ver Ficha</th>
					</tr>
					<c:forEach items="${propiedades}" var="propiedad">
						<tr>
							<td>${propiedad.number}</td>
							<td>${propiedad.address}</td>
							<td>${propiedad.comuna}</td>
							<td>${propiedad.meters}</td>
							<td>${propiedad.statusName}</td>
							<td>${propiedad.created}</td>
							<td>${propiedad.visits}</td>
							<td>${propiedad.visited}</td>

							<td style="text-align: center;"><c:choose>
									<c:when test="${propiedad.perseption==1}">
							Baja
							</c:when>
									<c:when test="${propiedad.perseption==2}">
							Media
							</c:when>
									<c:otherwise>
							Alta
							</c:otherwise>
								</c:choose></td>
							<td>${propiedad.responsable}</td>
							<td><a target="_blank" class="ui-btn ui-icon-forward ui-btn-icon-right"
								href="${pageContext.request.contextPath}/consultar_propiedad/${propiedad.number}"
								data-ajax="false" data-role="button">Ver Ficha</a></td>

						</tr>
					</c:forEach>


				</table>
			</div>
		</div>
	</div>

	<!-- /content -->

</body>
</html>
